#include <stdio.h>
#include "cmd.h"

int main(int argc, char **argv)
{
	char *script = NULL;
	FILE *fp = stdin;

	printf("---Serval's DIAG---\n");

	if (argc == 2) {
		script = argv[1];
		if ((fp = fopen(script, "r")) == NULL) {
			printf("open script %s fail.\n", script);
			return 1;
		}
	}

	cmd_loop(fp);

	if (fp != stdin)
		fclose(fp);

	return 0;
}

